package com.zzl.springboot_mybatis_demo.service.book.impl;

import com.zzl.springboot_mybatis_demo.entity.book.Book;
import com.zzl.springboot_mybatis_demo.mapper.book.BookMapper;
import com.zzl.springboot_mybatis_demo.service.book.BookService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * description: 书籍服务接口实现类
 * @author 朱正磊
 * @date 2019-12-08 21:25:50
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BookServiceImpl implements BookService {

    @Resource
    private BookMapper bookMapper;

    /**
     * description: 根据主键查询唯一数据
     * @author 朱正磊
     * @date 2019-12-08 21:19:04
     * @param id 主键
     * @return 返回唯一数据
     */
    @Override
    public Book queryBookById(Integer id) {
        return bookMapper.queryBookById(id);
    }

    /**
     * description: 查询所有数据
     * @author 朱正磊
     * @date 2019-12-08 21:19:09
     * @return 返回所有数据
     */
    @Override
    public List<Book> queryAllBook() {
        return bookMapper.queryAllBook();
    }

}
